//
//  DCIDCardImagePicker.m
//  JiuyaoDriver
//
//  Created by 大橙子 on 2018/11/29.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCIDCardImagePicker.h"

@implementation DCIDCardImagePicker
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.width - 30, 30)];
        titleLabel.textAlignment = NSTextAlignmentCenter;
        titleLabel.textColor = [UIColor lightGrayColor];
        titleLabel.font = FONT(15);
        self.titleLabel = titleLabel;
        [self addSubview:titleLabel];
        
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(titleLabel.x, titleLabel.bottom, titleLabel.width, self.height - titleLabel.height)];
//        imageView.backgroundColor = RandomColor;
        imageView.image = IMAGENAME(@"十字按钮");
        self.imageView = imageView;
        imageView.userInteractionEnabled = YES;
        [self addSubview:imageView];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imageViewTap)];
        [imageView addGestureRecognizer:tap];
    }
    return self;
}
-(void)imageViewTap {
    if (_block) {
        _block(self.imageView);
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
